home *** CD-ROM | disk | FTP | other *** search
- <?xml version="1.0" encoding="utf-8" ?>
- <!DOCTYPE stack PUBLIC "-//Apple, Inc.//DTD stack V 2.0//EN" "" >
- <stack>
- <name>in.1</name>
- <id>-1</id>
- <cardCount>4</cardCount>
- <cardID>5555</cardID>
- <listID>3742</listID>
- <cantModify><false /></cantModify>
- <cantDelete><false /></cantDelete>
- <cantAbort><false /></cantAbort>
- <cardSize>
- <width>512</width>
- <height>200</height>
- </cardSize>
- <script>--ΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇö stack "DX Map 1.1" 10/6/91 10:26 PM
- --
- -- HANDLERS: openstack(globals:itime,lastact,updateInterval,
- -- delayInterval,GrayLineFlag,mylat,mylon,tz),closestack
- -- (globals:GrayLineflag),fixfonts,DoGrayLineTask(globals:nextTask,
- -- itime,lastupd,tz,thepoints),DoGrayLineTask123(globals:nextTask,
- -- itime,lastupd,tz,thepoints),DoGrayLineTask23(globals:nextTask,
- -- itime,lastupd,tz,thepoints),DoGrayLineNow(globals:nextTask,
- -- lastact),trackit,domenu(globals:needfix,lastact),resumestack
- -- (globals:lastact),opencard(globals:lastact),DoSunPos
- -- (globals:tz),UpdateLocation(globals:mylat,mylon,tz),
- -- PutMyPos(globals:lastact,tz,mylat,mylon),UpdateTime(globals:tz)
-
- -- --
- -- FUNCTIONS: semitocom,semitocomns,daylightsavings,timecvt(globals:t24)
-
- -- --
- --ΓÇöΓÇöΓÇöΓÇöΓÇöΓÇöΓÇô
- on openstack
- global itime,lastact, updateInterval, delayInterval, GrayLineFlag,¬
- mylat,mylon,tz
- -- The globals below can be changed to configure the general
- -- actions of this stack.
- --
- -- timing:
- -- Updating and plotting the grayline takes about 25 seconds on
- -- a Mac Plus, about 5 seconds on a Mac IIcx, and about 2 seconds
- -- on a IIfx. If you have a Plus (like I do) you don't want to be
- -- locked out for a period of 25 seconds. So there are 3 timing
- -- devices to minimize the interruption. The global, delayInterval,
- -- is a grace period (in ticks) that you have whenever you do anything,
- -- like press one of the buttons. This prevents an interruption when
- -- you are busy doing something in the stack. The global,
- -- updateInterval, is the minimum time (in ticks) for the grayline
- -- to update. The time chosen below is based on the fact that the
- -- grayline moves 1 pixel to the left about every 4 minutes. The
- -- calculation of the grayline can be broken up into 3 operations,
- -- and the stack tries to do these so that they are equally spaced
- -- during the updateInterval.
-
- put 14400 into updateInterval -- update grayline every 4 minutes
- put 1200 into delayInterval -- 20 second wait after any action
-
- go first cd
- UpdateLocation
- if the highlight of cd btn "sun" is "true" then
- put "false" into Graylineflag
- else
- put "true" into GrayLineflag
- end if
- updatetime
- DoSunPos
- if (( highlight of btn "Draw grayline on open" of cd "config") is "true") then
- dograylinenow
- end if
- put the ticks into itime
- put the ticks into lastact
- put 1 into nextTask
- pass openstack
- end openstack
-
- on closestack
- global GrayLineflag
- if GrayLineflag is "true" then
- set the lockmessages to true
- set cursor to "watch"
- lock screen
- set the lockmessages to true
- set the lockRecent to true
- go cd "c2"
- choose select tool
- domenu "Select All"
- domenu "Copy Picture"
- go cd "c1"
- domenu "Paste Picture"
- choose browse tool
- unlock screen
- set the lockmessages to false
- set the lockRecent to false
- end if
- pass closestack
- end closestack
-
- on fixfonts
- set textfont of cd fld "country list" to "MonaHam"
- set textfont of cd fld "f1" to "MonaHam"
- set textfont of cd fld "utctime" to "MonaHam"
- set textfont of cd fld "localtime" to "MonaHam"
- set textfont of cd fld "otime" to "MonaHam"
- set textfont of cd fld "list" to "MonaHam"
- set textfont of cd fld "find call" to "MonaHam"
- end fixfonts
-
- on DoGrayLineTask
- global nextTask,itime, lastupd,tz, thepoints
- put the ticks into ttt
- put the ticks into itime
- if nextTask is 1 then -- calculate the points
- set cursor to "watch"
- if daylightsavings() is "false" then -- dls
- get SunPos(tz)
- else
- get SunPos(tz+1)
- end if
- put GrayPos(item 1 of it, item 2 of it) into thepoints
- end if
- if nextTask is 2 then -- draw the line
- set cursor to "watch"
- lock screen
- put thepoints into fff
- go cd "c3"
- choose line tool
- put number of items in fff into n2
- repeat with i=1 to (n2/2 - 1)
- drag from ((item (2*i-1) of fff) & "," & (item (2*i) of fff))¬
- to ((item (2*i+1) of fff) & "," & (item (2*i+2) of fff))
- end repeat
- choose browse tool
- go cd "c1"
- unlock screen
- end if
- if nextTask is 3 then -- get fresh map and paste night region
- set cursor to "watch"
- lock screen
- go cd "c2"
- choose select tool
- domenu "Select All"
- domenu "Copy Picture"
- go cd "c1"
- domenu "Paste Picture"
- go cd "c3"
- drag from 152,0 to 512,200 with optionkey
- domenu "Cut Picture"
- go cd "c1"
- domenu "Paste Picture"
- domenu "pickup"
- domenu "invert"
- choose browse tool
- put the ticks into lastupd
- unlock screen
- end if
- if nextTask <> 3 then
- add 1 to nextTask
- else
- put 1 into nextTask
- end if
- end DoGrayLineTask
-
-
- on DoGrayLineTask123
- global nextTask,itime, lastupd,tz, thepoints
- put the ticks into xxxx
- set the lockMessages to true
- set the lockRecent to true
- set cursor to "watch"
- lock screen
- if daylightsavings() is "false" then -- dls
- get SunPos(tz)
- else
- get SunPos(tz+1)
- end if
- put GrayPos(item 1 of it, item 2 of it) into thepoints
- put thepoints into fff
- go cd "c3"
- choose line tool
- put number of items in fff into n2
- repeat with i=1 to (n2/2 - 1)
- drag from ((item (2*i-1) of fff) & "," & (item (2*i) of fff))¬
- to ((item (2*i+1) of fff) & "," & (item (2*i+2) of fff))
- end repeat
- go cd "c2"
- choose select tool
- domenu "Select All"
- domenu "Copy Picture"
- go cd "c1"
- domenu "Paste Picture"
- go cd "c3"
- drag from 152,0 to 512,200 with optionkey
- domenu "Cut Picture"
- go cd "c1"
- domenu "Paste Picture"
- domenu "pickup"
- domenu "invert"
- choose browse tool
- put the ticks into lastupd
- put the ticks into itime
- put 1 into nextTask
- unlock screen
- set the lockMessages to false
- set the lockRecent to false
- --put (the ticks - xxxx) / 60
- end DoGrayLineTask123
-
- on DoGrayLineTask23
- global nextTask,itime, lastupd,tz,thepoints
- set cursor to "watch"
- lock screen
- put thepoints into fff
- go cd "c3"
- choose line tool
- put number of items in fff into n2
- repeat with i=1 to (n2/2 - 1)
- drag from ((item (2*i-1) of fff) & "," & (item (2*i) of fff))¬
- to ((item (2*i+1) of fff) & "," & (item (2*i+2) of fff))
- end repeat
- go cd "c2"
- choose select tool
- domenu "Select All"
- domenu "Copy Picture"
- go cd "c1"
- domenu "Paste Picture"
- go cd "c3"
- drag from 152,0 to 512,200 with optionkey
- domenu "Cut Picture"
- go cd "c1"
- domenu "Paste Picture"
- domenu "pickup"
- domenu "invert"
- choose browse tool
- put the ticks into lastupd
- put the ticks into itime
- put 1 into nextTask
- unlock screen
- end DoGrayLineTask23
-
-
- on DoGrayLineNow
- global nextTask, lastact
- put the ticks into lastact
- if nexttask = 1 then
- DoGrayLineTask123
- else if nexttask = 2 then
- DoGrayLineTask23
- else
- DoGrayLineTask
- end if
- end DoGrayLineNow
-
- on trackit
- if the mouseloc is within the rect of cd btn "mapbtn" then ¬
- set the loc of the target to the mouseloc
- put round(90 - (0.89109 * (item 2 of the loc of the target))) into lat
- put round((item 1 of the loc of the target - 153) * 1.0056 - 180) into lon
- put abs(lat) into stuff
- if lat > 0 then
- put "┬░ North" & return after stuff
- else
- put "┬░ South" & return after stuff
- end if
- put abs(lon) after stuff
- if lon > 0 then
- put "┬░ East" after stuff
- else
- put "┬░ West" after stuff
- end if
- put stuff into cd fld "f1"
- end trackit
-
- on domenu thing
- global needfix, lastact
- if thing is "Compact Stack" then
- put "yes" into needfix
- end if
- put the ticks into lastact
- pass domenu
- end domenu
-
- on resumestack
- global lastact
- put the ticks into lastact
- pass resumestack
- end resumestack
-
- on opencard
- global lastact
- put the ticks into lastact
- pass opencard
- end opencard
-
- function semitocom craig
- repeat until (offset(";", craig) = 0)
- put offset(";", craig) into sco
- put "," into char sco of craig
- put " " after char sco of craig
- end repeat
- return craig
- end semitocom
-
- function semitocomns craig
- repeat until (offset(";", craig) = 0)
- put offset(";", craig) into sco
- put "," into char sco of craig
- end repeat
- return craig
- end semitocomns
-
- on DoSunPos
- global tz
- if daylightsavings() is "false" then -- dls
- put SunPos(tz) into tsp
- else
- put SunPos(tz+1) into tsp
- end if
- put round((item 2 of tsp + 180) * (511 - 153) / 360 + 153) & "," into pos
- put round((90- item 1 of tsp) * (202-0) / 180 + 0) after pos
- set the location of btn "sun" to pos
- end DoSunPos
-
- function daylightsavings
- if the highlight of btn "auto daylight savings" of cd "config" ¬
- is "false" then
- if the highlight of btn "summer time" of cd "config" is "true" then
- put "true" into daylightsavings
- else
- put "false" into daylightsavings
- end if
- else
- put the time into mytime
- convert mytime to dateitems
- if (item 2 of mytime < 4) or (item 2 of mytime >10) then
- put "false" into daylightsavings
- else if (item 2 of mytime > 4) and (item 2 of mytime <10) then
- put "true" into daylightsavings
- else if (item 2 of mytime is 4) then -- April
- if item 3 of tt > 7 then
- put "false" into daylightsavings
- else
- --find the witching hour
- put mytime into cutover
- convert cutover to dateitems
- repeat with i = 1 to 7
- put i into item 3 of cutover
- convert cutover to long date
- convert cutover to dateitems
- if item 7 of cutover is 1 then exit repeat
- end repeat
- put 2 into item 4 of cutover -- 2 am is the time
- convert cutover to seconds
- convert mytime to seconds
- if mytime >= cutover then
- put "true" into daylightsavings
- else
- put "false" into daylightsavings
- end if
- end if
- else -- October
- if item 3 of mytime < 24 then
- put "true" into daylightsavings
- else
- --find the witching hour
- put mytime into cutover
- convert cutover to dateitems
- repeat with i = 24 to 31
- put i into item 3 of cutover
- convert cutover to long date
- convert cutover to dateitems
- if item 7 of cutover is 1 then exit repeat
- end repeat
- put 2 into item 4 of cutover -- 2 am is the time
- convert cutover to seconds
- convert mytime to seconds
- if mytime >= cutover then
- put "false" into daylightsavings
- else
- put "true" into daylightsavings
- end if
- end if
- end if
- end if
- return daylightsavings
- end daylightsavings
-
- on UpdateLocation
- global mylat,mylon,tz
- if the highlight of btn "Location" of cd "config" is true then
- GetLocale
- put the result into locres
- if word 1 of locres is "Error" then
- Beep
- answer "Error getting your location from parameter RAM. Go to the next card and set it manually." with "OK"
- else
- put item 1 of locres into mylat
- put item 2 of locres into mylon
- end if
- else
- put cd fld "lat" of cd "config" into tlat
- if (tlat is a number) and (tlat>=0) and (tlat<=90) then
- if the highlight of btn "N" of cd "config" is true then
- put tlat into mylat
- else
- put -tlat into mylat
- end if
- else
- Beep
- answer "Invalid latitude" with "OK"
- go cd "config"
- exit updatelocation
- end if
- put cd fld "lon" of cd "config" into tlon
- if (tlon is a number) and (tlon>=0) and (tlon<=180) then
- if the highlight of btn "E" of cd "config" is true then
- put tlon into mylon
- else
- put -tlon into mylon
- end if
- else
- Beep
- answer "Invalid latitude" with "OK"
- go cd "config"
- exit updatelocation
- end if
- end if
- if the highlight of btn "Time Zone" of cd "config" is true then
- GetLocale
- put the result into locres
- if word 1 of locres is "Error" then
- Beep
- answer "Error getting your time zone from parameter RAM" with "OK"
- else
- put item 3 of locres into tz
- end if
- else
- put cd fld "tz" of cd "config" into ttz
- if (ttz is a number) and (ttz>=-24) and (ttz<=24) then
- put ttz into tz
- else
- Beep
- answer "Invalid time difference" with "OK"
- go cd "config"
- exit updatelocation
- end if
- end if
- PutMyPos
- DoSunPos
- end UpdateLocation
-
- on PutMyPos
- global lastact,tz,mylat,mylon
- put round((mylon + 180) * (511 - 153) / 360 + 153) & "," into pos
- put round((90-mylat) * (202-0) / 180 + 0) after pos
- set the location of btn "here" to pos
- if (item 1 of pos) > 483 then put 483 into item 1 of pos
- if (item 1 of pos) < 181 then put 181 into item 1 of pos
- put 5 into item 2 of pos
- set the loc of cd fld "localtime" to pos
- if tz is not empty then
- show cd fld "utctime"
- if cd fld "otz" is not empty then
- show cd fld "otime"
- end if
- updatetime
- else
- hide cd fld "otime"
- hide cd fld "utctime"
- end if
- put the ticks into lastact
- end PutMyPos
-
- On UpdateTime
- global tz
- put timecvt(the time) into cd fld "Localtime"
- if tz is not empty then
- put the time into ttemp
- convert ttemp to dateItems
- convert ttemp to seconds
- add -tz * 3600 to ttemp
- if daylightsavings() is "true" then subtract 3600 from ttemp -- dls
- convert ttemp to dateItems
- put item 4 of ttemp into hr
- put item 5 of ttemp into mn
- if length of hr = 1 then put "0" & hr into hr
- if length of mn = 1 then put "0" & mn into mn
- put hr & mn && "UTC" into cd field UTCtime
- if cd fld "otz" is not empty then
- put the time into ttemp
- convert ttemp to seconds
- add -((cd fld "otz") + tz) * 3600 to ttemp -- assumes summer time
- if daylightsavings() is "true" then subtract 3600 from ttemp -- dls
- convert ttemp to short time
- put timecvt(ttemp) into cd fld "otime"
- end if
- end if
- end UpdateTime
-
- function timecvt mytime
- global t24
- if t24 is "true" then
- put offset(":",mytime) into colonpos
- put char 1 to (colonpos-1) of mytime into hr
- put char (colonpos+1) to (colonpos+2) of mytime into min
- put empty into prefix
- if hr is "12" then
- if word 2 of mytime is "AM" then
- put "0" into hr
- else
- put 12 into hr
- end if
- else
- if word 2 of mytime is "PM" then add 12 to hr
- end if
- if hr < 10 then put "0" after prefix
- return prefix & hr & min
- else
- return mytime
- end if
- end timecvt
-
- </script>
- <background id="2672" file="background_2672.xml" name="" />
- <card id="5555" file="card_5555.xml" marked="false" name="c1" owner="2672" />
- <card id="3866" file="card_3866.xml" marked="false" name="config" owner="2672" />
- <card id="2241" file="card_2241.xml" marked="false" name="c2" owner="2672" />
- <card id="3023" file="card_3023.xml" marked="false" name="c3" owner="2672" />
- </stack>
-